@extends('layouts.app')

@section('title', '页面列表')

@section('content')
<div class="container py-4">
    <!-- Page Header -->
    <div class="row mb-4">
        <div class="col-12">
            <h1 class="h2 mb-3">站点页面</h1>
            <p class="text-muted">浏览所有站点页面</p>
        </div>
    </div>

    @if($pages->count() > 0)
        <div class="row g-4">
            @foreach($pages as $page)
                <div class="col-lg-4 col-md-6">
                    <div class="card h-100 shadow-sm">
                        <div class="card-body d-flex flex-column">
                            <h5 class="card-title">
                                <a href="{{ route('pages.show', $page->slug) }}" class="text-decoration-none">
                                    {{ $page->title }}
                                </a>
                            </h5>
                            
                            @if(Str::length(strip_tags($page->content)) > 0)
                                <p class="card-text text-muted">
                                    {{ Str::limit(strip_tags($page->content), 120) }}
                                </p>
                            @endif
                            
                            <div class="mt-auto">
                                <div class="d-flex justify-content-between align-items-center">
                                    <small class="text-muted">
                                        <i class="bi bi-calendar"></i> {{ $page->updated_at->format('Y-m-d') }}
                                        @if($page->template && $page->template !== 'default')
                                            <br><i class="bi bi-file-earmark"></i> {{ $page->template }}
                                        @endif
                                    </small>
                                    <a href="{{ route('pages.show', $page->slug) }}" class="btn btn-outline-primary btn-sm">
                                        查看页面
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            @endforeach
        </div>
    @else
        <div class="text-center py-5">
            <h3 class="text-muted">暂无页面</h3>
            <p class="text-muted">还没有创建任何页面</p>
        </div>
    @endif
</div>
@endsection